package com.linsir.aop.linsir;

import com.jfinal.core.Controller;
import com.linsir.config.EovaConst;
import com.linsir.engine.EovaExp;
import com.linsir.model.Menu;
import com.linsir.model.MetaObject;
import com.linsir.model.User;


/**
 * @author linsir
 * @title: EovaContext
 * @projectName linsir-mu
 * @description: Eova全局业务拦截器上下文
 * @date 2021/12/2 10:54
 */
public class EovaContext {

        /**
         * 当前控制器
         */
        public Controller ctrl;

        /**
         * 当前用户对象
         */
        public User user;

        /**
         * 当前菜单
         */
        public Menu menu;

        /**
         * 当前元对象
         * 元字段=object.fields
         *
         */
        public MetaObject object;

        /**
         * 当前操作表达式
         */
        public EovaExp exp;

        public EovaContext(Controller ctrl) {
                this.ctrl = ctrl;
                this.user = (User) ctrl.getSessionAttr(EovaConst.USER);
        }

        public int UID() {
                return this.user.get("id");
        }
}
